<?xml version="1.0" encoding="utf-8"?>
<!-- DWXMLSource="cotizacion.xml" -->

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:doc='http://wlm.com.mx/SAI/doc'>
  <xsl:output method="html" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
  <xsl:param name="tipoImpresion"></xsl:param>
  <xsl:decimal-format name="dollar"
decimal-separator="." grouping-separator=","/>
  <xsl:template match="//doc:Documento">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Documento Cotizacion</title>
    </head>
    <body>
    <style>
    .texto
	{
		font-family:Tahoma, Geneva, sans-serif;
		font-size:11px;
		font-weight:bold;
		line-height:15px;
		
		text-transform:uppercase;
	}
    </style>
    <div id="ContenedorPrincipal" style="text-transform:uppercase;width:260px;" class="texto">
      <div id="header">
        
Salida de Material<br/>
              Remision
No. 

              <xsl:value-of select="@NoPedido"/>     
      </div>
      <div style="margin-top:5px;">
        
        MANUFACTURE PROFESSIONAL HARDWARE<br/>
          www.mphardware.com<br /><br />
        ALDACO 11, L-5<br/>
        Colonia Centro, CUAUHTEMOC<br/>
        Mexico, Distrito Federal, C.P. 06080<br/>
        Tel. 555-518-5802  ventas@mphardware.com<br/><br/>
        <xsl:if test="@NoCliente!=175">
          <xsl:value-of select="@RFC"/>
          <br/>
          <xsl:value-of select="@NombreCliente"/>
          <br/>
        
        </xsl:if>
      </div>
      <div style="display:block; width:260px;">
        <div id="NombreCliente"> Venta de Aparador</div>
        <div>
        <div style="width:260px;">
          <table id="meta" class="texto" cellpadding="0" cellspacing="0">
            <tbody>
              <tr>
                
                
                <td>
        
                      <xsl:call-template name="FormatDate">
                        <xsl:with-param name="DateTime" select="@FechaCreacion"/>
                      </xsl:call-template>
                    
                  </td>
              </tr>
              
              
            </tbody>
          </table>
        </div>
        
        </div>
        
      </div>
      <br />
      <div>
        <table id="items" class="texto" cellpadding="0" cellspacing="0">
          <tbody>
            <tr>
              <td style="width:100px; max-width:100px;">Descripcion</td>
              <td style="width:32px;">Can</td>
              <xsl:if test="$tipoImpresion!=3">
                <td style="width:50px;">Precio</td>
                <td style="width:50px;">Importe</td>
              </xsl:if>
            </tr>
            <xsl:apply-templates  select="//doc:Concepto">
              <xsl:with-param name="tipoImp" select="$tipoImpresion"/>
            </xsl:apply-templates>
            <xsl:for-each select="Concepto">
            </xsl:for-each>


            <xsl:if test="$tipoImpresion!=3">
              <tr>
                <td rowspan="3" class="blank" valign="top" style="padding:20px;">
                  
                </td>
                <td colspan="2" class="total-line">Subtotal</td>
                <td class="total-value moneda" style="text-align:right;">
                  <div id="subtotal">
                    $<xsl:value-of select="format-number(@SubTotal, '#,##0.00','dollar')"/>
                  </div>
                </td>
              </tr>
              
              <tr>
                <td colspan="2" class="total-line">I.V.A.</td>
                <td class="total-value moneda" style="text-align:right;">
                  $<xsl:value-of select="format-number(@IVA, '#,##0.00','dollar')"/>
                </td>
              </tr>
              <tr>
                <td colspan="2" class="total-line balance">TOTAL</td>
                <td class="total-value balance moneda" style="text-align:right;">
                  <div class="due">
                    $<xsl:value-of select="format-number(@Total, '#,##0.00','dollar')"/>
                  </div>
                </td>
              </tr>
              
            </xsl:if>
            
          </tbody>
        </table>
      </div>
      <div style="text-align:center;" class="texto">
        *******************************<br />
        
        SALIDA LA MERCANCIA NO HAY<br/> CAMBIOS NI DEVOLUCIONES<br/>
        
        ¡¡¡GRACIAS POR SU COMPRA!!!<br />
        
        ********************************<br />
      </div>
    </div>
    </body>
    </html>
  </xsl:template>
  <xsl:template match="//doc:Concepto">
    <xsl:param name="tipoImp"></xsl:param>
    <tr class="item-row">
      
      <td valign="top">
        <xsl:value-of select="@descripcion"/>
      </td>
      <td style="text-align:right;" valign="top">
        <xsl:value-of select="@cantidad"/>
        
      </td>
      <xsl:if test="$tipoImp!=3">
        <td style="text-align:right;" valign="top">
          $<xsl:value-of select="format-number(@valorUnitario, '#,##0.00','dollar')"/>
        </td>
        <td style="text-align:right;" valign="top">

            $<xsl:value-of select="format-number(@importe, '#,##0.00','dollar')"/>
        </td>
      </xsl:if>
    </tr>
    
  </xsl:template>
 
  <xsl:template match="//doc:DireccionFacturacion">
    <xsl:value-of select="@Calle"/><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text><xsl:value-of select="@NumeroExterior"/><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>-<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text><xsl:value-of select="@NumeroInterior"/><br/>
    <xsl:value-of select="@Colonia"/>, <xsl:value-of select="@Municipio"/><br/>
  <xsl:value-of select="@Ciudad"/>, <xsl:value-of select="@Estado"/><br/>
  C.P.<xsl:value-of select="@CP"/>
    
  </xsl:template>
  <xsl:template match="//doc:DireccionEnvio">
    <div id="address"><div id="addressheader">Direccion de Envio:</div>
    <table id="meta-1" class="texto">
            <tbody>
              <tr>
                <td>
                  <xsl:value-of select="@Calle"/><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text><xsl:value-of select="@NumeroExterior"/><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>-<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text><xsl:value-of select="@NumeroInterior"/><br/>
                  <xsl:value-of select="@Colonia"/>, <xsl:value-of select="@Ciudad"/><br/>
                  <xsl:value-of select="@Municipio"/>, <xsl:value-of select="@Estado"/><br/>
                  C.P.<xsl:value-of select="@CP"/>
                </td>
              </tr>
              </tbody>
              </table>
      </div>
  </xsl:template>
  <xsl:template name="FormatDate">
    <xsl:param name="DateTime" />
    <xsl:variable name="year" select="substring($DateTime,1,4)" />
    <xsl:variable name="month-temp" select="substring-after($DateTime,'-')" />
    <xsl:variable name="month" select="substring-before($month-temp,'-')" />
    <xsl:variable name="day-temp" select="substring-after($month-temp,'-')" />
    <xsl:variable name="day" select="substring($day-temp,1,2)" />
    <xsl:variable name="time" select="substring-after($DateTime,'T')" />
    <xsl:variable name="hh" select="substring($time,1,2)" />
    <xsl:variable name="mm" select="substring($time,4,2)" />
    <xsl:variable name="ss" select="substring($time,7,2)" />
    
    <!-- Long DATE FORMAT -->
    
    <xsl:value-of select="$day"/><xsl:value-of select="' de '"/><!--January -->
    <!--January 12 -->
    <xsl:choose>
      <xsl:when test="$month = '1' or $month= '01'">
        Enero
      </xsl:when>
      <xsl:when test="$month = '2' or $month= '02'">
        Febrero
      </xsl:when>
      <xsl:when test="$month= '3' or $month= '03'">
        Marzo
      </xsl:when>
      <xsl:when test="$month= '4' or $month= '04'">
        Abril
      </xsl:when>
      <xsl:when test="$month= '5' or $month= '05'">
        Mayo
      </xsl:when>
      <xsl:when test="$month= '6' or $month= '06'">
        Junio
      </xsl:when>
      <xsl:when test="$month= '7' or $month= '07'">
        Julio
      </xsl:when>
      <xsl:when test="$month= '8' or $month= '08'">
        Augosto
      </xsl:when>
      <xsl:when test="$month= '9' or $month= '09'">
        Septiembre
      </xsl:when>
      <xsl:when test="$month= '10'">
        Octubre
      </xsl:when>
      <xsl:when test="$month= '11'">
        Noviembre
      </xsl:when>
      <xsl:when test="$month= '12'">
        Diciembre
      </xsl:when>
    </xsl:choose>
    <xsl:value-of select="' de'"/><!--January 12,-->
    <xsl:value-of select="' '"/><!--January 12, -->
    <xsl:value-of select="$year"/><!--January 12, 2001-->
    <xsl:value-of select="' '"/>
    <xsl:value-of select="$hh"/>
    <xsl:value-of select="':'"/>
    <xsl:value-of select="$ss"/>
    <!--
    <xsl:value-of select="' a las '"/><xsl:value-of select="$hh"/><xsl:value-of select="':'"/><xsl:value-of select="$mm"/><xsl:value-of select="':'"/><xsl:value-of select="$ss"/><xsl:value-of select="' (GMT) '"/>-->
    <!-- END: Long DATE FORMAT -->
    
  </xsl:template>
</xsl:stylesheet>



<!-- Este es un select que se utilizara para ocupar un solo codumento en caso de poder enviar parametros
   <xsl:for-each select="turtle">
      <xsl:choose>
        <xsl:when test="position() = 1">
          <xsl:text>(</xsl:text>
          <xsl:apply-templates select="."/>
          <xsl:text>)</xsl:text>
        </xsl:when>
        <xsl:when test="position() = count()">
          <xsl:text>[</xsl:text>
          <xsl:apply-templates select="."/>
          <xsl:text>]</xsl:text>
        </xsl:when>
        <xsl:otherwise>
          <xsl:apply-templates select="."/>
        </xsl:otherwise>
      </xsl:choose>      
    </xsl:for-each>
-->